package org.stvd.repository.message.impl;

import java.util.Date;

import org.springframework.stereotype.Repository;
import org.stvd.core.dto.QueryResult;
import org.stvd.entities.message.BsMessageInfo;
import org.stvd.repository.base.impl.BaseDaoImpl;
import org.stvd.repository.message.BsMessageInfoDao;

/**
 * @Title: BsMessageInfoDaoImpl
 * @Description: 消息内容数据层接口类
 * @author houzx
 * @date 2020年9月18日
 */
@Repository("BsMessageInfoDao")
public class BsMessageInfoDaoImpl extends BaseDaoImpl<BsMessageInfo> implements BsMessageInfoDao{

    @Override
    public QueryResult<BsMessageInfo> querySendMessageResult(int start, int limit, 
        Date queryStartDate, Date queryEndDate, String title, String sendId) {
        String hql = "FROM BsMessageInfo WHERE (createTime >= ?0 OR ?0 IS NULL)"
            + " AND (createTime < ?1 OR ?1 IS NULL)"
            + " AND title LIKE ?2"
            + " AND createUser = ?3 "
            + " ORDER BY createTime DESC";
        return getQueryResultByHQL(start, limit, hql, queryStartDate, queryEndDate, "%"+title+"%", sendId);
    }

}
